/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import java.util.UUID;

/**
 * <p>Project: javase - Img1
 * <p>Powered by webrx On 2021-12-09 14:30:25
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Img1 {
    public static void main(String[] args) {
        var i = new BufferedImage(300, 180, BufferedImage.TYPE_INT_RGB);
        var g = i.createGraphics();
        //g.setColor(Color.RED);
        for (int i1 = 0; i1 < 20; i1++) {
            var r = new Random();
            //g.setColor(new Color(0xffff00));
            g.setColor(new Color(r.nextInt(256), r.nextInt(256), r.nextInt(256), r.nextInt(256)));
            g.fillRect(0, 0, 300, 180);
            try {
                String u = UUID.randomUUID().toString().toLowerCase();
                ImageIO.write(i, "png", new File(String.format("c:/%s.png", u)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
